//
//  UIView+Frame.m
//  微博
//
//  Created by 陈帅府 on 15-3-22.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

#import "UIView+Frame.h"

@implementation UIView (Frame)

- (void)setX:(CGFloat)x{
    CGRect tempFrame = self.frame;
    tempFrame.origin.x = x;
    self.frame = tempFrame;

}
- (CGFloat)x{

    return self.frame.origin.x;

}
- (void)setY:(CGFloat)y{
    CGRect tempFrame = self.frame;
    tempFrame.origin.y = y;
    self.frame = tempFrame;
}
- (CGFloat)y{

    return self.frame.origin.y;
}
- (CGFloat)height{

    return self.frame.size.height;
}
- (void)setHeight:(CGFloat)height{

    CGRect tempFrame = self.frame;
    tempFrame.size.height = height;
    self.frame = tempFrame;
}
- (void)setWidth:(CGFloat)width{

    CGRect tempFrame = self.frame;
    tempFrame.size.width = width;
    self.frame = tempFrame;

}
- (CGFloat)width{

    return self.frame.size.width;
}

- (CGFloat)centerX{

    return self.center.x;
}
- (void)setCenterX:(CGFloat)centerX{

    CGPoint tempCenter = self.center;
    tempCenter.x = centerX;
    self.center = tempCenter;
}
//- (CGFloat)centerY
//{
//    return self.center.y;
//}
//
//- (void)setCenterY:(CGFloat)centerY
//{
//    CGPoint tempCenter =  self.center;
//    tempCenter.y = centerY;
//    self.center = tempCenter;
//}
- (CGFloat)centerY{

    return self.center.y;
}

- (void)setCenterY:(CGFloat)centerY{
    CGPoint tempCenter = self.center;
    tempCenter.y = centerY;
    self.center = tempCenter;

}
- (void)setSize:(CGSize)size{
    CGRect tempFrame = self.frame;
    tempFrame.size = size;
    self.frame = tempFrame;
}
- (CGSize)size{

    return self.frame.size ;
}
@end
